<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVLossesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('v_losses', function (Blueprint $table) {
            $table->increments('id');
            $table->bigInteger('shipping_id')->default(0)->comment('货运ID');
            $table->integer('loss_total_num')->default(0)->comment('扣损总量');
            $table->integer('loss_num')->default(0)->comment('扣损超出数量');
            $table->integer('loss_amount')->default(0)->comment('扣损金额，单位：元');
            $table->timestamps();
            $table->index('shipping_id', 'idx_shipping_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('v_losses');
    }
}
